''Main function to call
Type funcarray

	''Main function to call
	dim BotMain As Function (rawmsg as String) as message

	''Handle of shared lib
	hndl As Any ptr
End Type

dim shared file as string

''Array for storing functions/lib handles
dim shared BotArray(128) As funcarray

dim shared numofplugins as uinteger

sub LoadPlugins ()
''counter
dim i As UInteger=0
numofplugins=0


''File to retrieve
#ifdef __FB_LINUX__
   file=Dir  ( "*.so" )
#endif

#ifdef __FB_WIN32__
   file=Dir ( "*.dll" )
#endif

''Get handle of file (TODO: add error checking)
BotArray(i).hndl=DylibLoad(file)
BotArray(i).BotMain=DylibSymbol(BotArray(i).hndl, "BotMain")


''Start grabbing plugins
Do
	
	''Get file	
	file=Dir( )
	''No file? GTFO
	If file = "" Then Exit Do
	
	''Increment array index
	i+=1
	
	''Load next lib
	BotArray(i).hndl=DylibLoad(file)
	BotArray(i).BotMain=DylibSymbol(BotArray(i).hndl, "BotMain")
	
Loop

numofplugins=i

end sub

LoadPlugins()

''how to call: BotArray(i).BotMain(string_to_send). "i" can be anything, as long as it's a function already loaded.
